@extends('mobile.layout1')
@section('title','订单列表')
@section('css')
    <link rel="stylesheet" href="{{asset('FENXIAO/js/dropload-gh-pages/dist/dropload.css')}}">
    @endsection
@section('content')
    <body>
    <div class="view-container mgn55">
        <div class="view-inner">
            <div class="tab-nav order-nav-tab">
                <a class="@if(Request::fullUrl()==route('my.order'))active @endif item" href="{{route('my.order')}}">全部</a>
                <a class="item @if(Request::fullUrl()==route('my.order',['pay_status'=>0]))active @endif" href="{{route('my.order',['pay_status'=>0])}}">待付款</a>
                <a class="item   @if(Request::fullUrl()==route('my.order',['ship_status'=>\App\OrderPay::SHIP_STATUS_PENDING]))active @endif" href="{{route('my.order',['ship_status'=>\App\OrderPay::SHIP_STATUS_PENDING])}}">待发货</a>
                <a class="item @if(Request::fullUrl()==route('my.order',['ship_status'=>\App\OrderPay::SHIP_STATUS_DELIVERED]))active @endif" href="{{route('my.order',['ship_status'=>\App\OrderPay::SHIP_STATUS_DELIVERED])}}">待收货</a>
                <a class="item @if(Request::fullUrl()==route('my.order',['ship_status'=>\App\OrderPay::SHIP_STATUS_RECEIVED]))active @endif" href="{{route('my.order',['ship_status'=>\App\OrderPay::SHIP_STATUS_RECEIVED])}}">已完成</a>
            </div>
            <div class="order-list-container">
                <ul class="js-order-list" >
@if($orderPay==0)
                        <div class="order-no-img"></div>
    @endif
                </ul>


                <div class="jiazai"></div>
            </div>
        </div>
    </div>
    </body>
    </html>
    @endsection
@section('js')
    @if($orderPay>0)
    <script type="text/javascript" src="{{asset('FENXIAO/js/dropload-gh-pages/dist/dropload.js')}}"></script>

    <script>


        $(function(){
            var itemIndex = 0;
            var tab1LoadEnd = false;
            var tab2LoadEnd = false;
            var tab3LoadEnd = false;
            var tab4LoadEnd= false;
            var tab5LoadEnd= false;
            // tab


            var counter = 0;

            var page = 1;
            var ship_status='{{Request::get('ship_status')}}';
            var pay_status='{{Request::get('pay_status')}}';
            // dropload
            var dropload = $('.jiazai').dropload({
                scrollArea : window,
                loadDownFn : function(me){
                    // 加载菜单一的数据
                    if(itemIndex == '0'){
                        $.ajax({
                            type: 'GET',
                            url: '/my/orderAjax',
                            data:{page:page,ship_status:ship_status,pay_status:pay_status},
                            dataType: 'text',
                            success: function(data){
                                var result = '';
                                page++;

                                if(data==''){
                                    // 数据加载完
                                    tab1LoadEnd = true;
                                    // 锁定
                                    me.lock();
                                    // 无数据
                                    me.noData();
                                }
                                $('.js-order-list').append(data);
                                me.resetload();


                            },
                            error: function(xhr, type){
                                //alert('Ajax error!');
                                // 即使加载出错，也得重置
                                me.resetload();
                            }
                        });
                        // 加载菜单二的数据
                    }
                }
            });
        });
    </script>
    @endif
    @endsection